Add image, file, and dataset attachments for web and CLI#186
Open
aryan5v wants to merge 6 commits intohuggingface:mainfrom
Open
Add image, file, and dataset attachments for web and CLI#186aryan5v wants to merge 6 commits intohuggingface:mainfrom
aryan5v wants to merge 6 commits intohuggingface:mainfrom
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Author
|
@lewtun can you help run the claude PR review |
|
closed per maintainer request |
Author
Don't know what you're talking about and why you're spamming this everywhere. This PR is ready for review when someone has time. Thanks! |
…-158 # Conflicts: # README.md # agent/core/agent_loop.py # agent/main.py # frontend/src/components/Chat/ChatInput.tsx
…ub.com/aryan5v/ml-intern into codex/attachments-157-158 # Conflicts: # README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Based on #157 and #158.
This PR adds user-selected image, file, and dataset attachments across the web UI and CLI.
The main design choice is to split attachments into two explicit modes:
What changed
Shared attachment layer
Adds
agent/core/attachments.py, which centralizes:Web UI
The chat composer now supports:
Attach to turnvsImport as datasettoggleWhen importing as a dataset, files are uploaded to a private dataset repo before the chat turn is submitted.
CLI
Headless mode now supports:
Interactive mode now supports:
--file,--image, and/attachare per-turn context only.--datasetand/datasetupload to the private HF dataset repo.Agent context and privacy
Attached text-like files include metadata and bounded previews in the agent turn.
Images are sent transiently as multimodal image parts so the LLM can inspect them, then redacted back to placeholders/manifest notes before persisted history or approval continuations can reuse the turn.
Dataset imports are stored under:
The agent receives the repo id, path prefix, manifest path, file list, sizes, MIME types, and guidance to use the HF dataset path for training/jobs.
Docs
Updated README with CLI and web usage examples for:
--file--image--dataset/attach/datasetCLI help now also lists
/attachand/dataset.Safety/correctness details
Import as datasettoggle.Test plan
python3 -m py_compile agent/core/attachments.py agent/core/agent_loop.py agent/main.py backend/routes/agent.py backend/session_manager.pyuv run pytest tests/unit/test_cli_rendering.py tests/unit/test_session_manager_persistence.py tests/unit/test_attachments.pynpm run buildAll targeted tests pass.
npm run buildpasses with the existing large chunk warning.Future improvements
[Image #1]/[File #1]draft chips before submit./attach PATHor--image PATH.